﻿@{
    ViewBag.Title = "TaskList";
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <title>@ViewBag.Title</title>
    @Html.Partial("CommonCssLinks")
    @Html.Partial("CommonScripts")
    <style type="text/css">
        .page
        {
            width: 837px;
            min-width: 837px;
            height: 392px;
            min-height: 392px;
            border: 0px;
            background-color: white;
        }
        table td
        {
            padding: 0;
        }
        
        .taskitem
        {
            width:800px;
            font-size:9pt;
            color:Black;
            }
        .status-none{background-color:White;}
        .status-comm{background-color:Gray;color:White}
        .status-ok{background-color:LightGreen;}
        .status-todo{background-color:Yellow;}
        .status-lock{background-color:LightBlue;}
    </style>
</head>

<body>
<h2>TaskList</h2>
<ol>
@{
    string fn = Server.MapPath("~/TaskList.txt");
    <li> tasklist: @fn </li>
    var backlog = System.IO.File.ReadAllLines(Server.MapPath("~/TaskList.txt"),System.Text.Encoding.GetEncoding("GB2312"));
    }
    @foreach (var line in backlog)
	{
        var item = line.Trim();
        var flag = "none";
        if (item.StartsWith("---")) {
            flag = "comm";
        }
        else if (item.StartsWith("OK") || item.StartsWith("AA"))
        {
            flag = "ok";
        }
        else if (item.StartsWith("--")) {
            flag = "todo";
        }else if(item.StartsWith("@@")){
            flag = "lock";
        }
        if (flag == "none")
        {
            <br />
        }
        else
        {
        <li class="taskitem status-@(flag)"><pre>@line </pre></li>
        }
	}
</ol>

</body>
</html>